package com.proton.carepatchtemp.fragment.dialogfragment;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;

import com.proton.carepatchtemp.R;

/**
 * Created by Api on 2016/11/7.
 */

public class WithoutLayoutLoginOutDialogFragment extends DialogFragment {
    public static WithoutLayoutLoginOutDialogFragment newInstance(int num) {
        WithoutLayoutLoginOutDialogFragment mWithoutLayoutLoginOutDialogFragment = new WithoutLayoutLoginOutDialogFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("num", num);
        mWithoutLayoutLoginOutDialogFragment.setArguments(bundle);
        return mWithoutLayoutLoginOutDialogFragment;
    }

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        return new AlertDialog.Builder(getActivity())
                .setTitle(R.string.sure_get_out)
                .setPositiveButton(R.string.yes, (dialog, which) -> getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, getActivity().getIntent()))
                .setNegativeButton(R.string.no, (dialog, which) -> getTargetFragment().onActivityResult(getTargetRequestCode(), Activity.RESULT_CANCELED, getActivity().getIntent()))
                .setMessage("")
                .create();
    }
}
